package com.hhb.leetCode.剑指offer;

import java.util.Arrays;

public class Test167 {

    public static void main(String[] args) {
        int[] arr = new int[]{2,7,11,15};
        int[] twoSum = Solution3.twoSum(arr, 9);
        System.out.println(Arrays.toString(twoSum));
    }


}
class  Solution3 {
    public static int[] twoSum(int[] numbers, int target) {

        Arrays.sort(numbers);
        for (int i = 0; i < numbers.length - 1; i++) {
            for (int j = i+1; j < numbers.length; j++) {
                if (numbers[i]+numbers[j]==target){
                    return new int[]{i+1,j+1};
                }
            }
        }
        return null;
    }
}


